#include "LocationInfo.h"
using namespace Planner;
int32_t LocationInfo::_origin_lat=-1;
int32_t LocationInfo::_origin_lon=-1;
int32_t LocationInfo::_origin_alt=-1;
LocationInfo::LocationInfo(int32_t lat,int32_t lon,int32_t alt)
:_lat(lat)
,_lon(lon)
,_alt(alt)
,_timestamp(CURRENT_TIME)
{
    _vector_ne._n=(_lat-_origin_lat)*LOCATION_SCALING_FACTOR_M;
    _vector_ne._e=(_lon-_origin_lat)*LOCATION_SCALING_FACTOR_M *longitudeScale();
}
double 
LocationInfo::distanceTo(const LocationInfo& tempinfo)const
{
    const vectorNE tempNE=tempinfo.getNEVector();
    return sqrt(pow(_vector_ne._n-tempNE._n,2.0)+pow(_vector_ne._e-tempNE._e,2.0));
}
double 
LocationInfo::normal()
{
    return sqrt(pow(_vector_ne._n,2.0)+pow(_vector_ne._e,2.0));
}